  $(function(){
	  //显示权限按钮
	  var parentUUID = $("input[name='parentUUID']").val();
   	  $.permission.showButton(parentUUID,"actionBtnArea");
   	  //表格初始化
	  $.dataGridEasyUI.initTable({
		  pageId:"#batchDataInfoListPage",
		  gridId:"#batchDataInfoList",
		  url:getBasePath()+'mdData/getBatchDataInfoList.do',
		  toolbarId:"#batchDataInfoListPage .tb_toolbar",
		  remoteSort:true,
		  columns:[[
	            {field:'uuid',title:'批次号',width:'12%'},
	            {field:'batchCount',title:'数据统计',width:'12%',sortable:true},
	            {field:'batchDesc',title:'批次说明',width:'15%',sortable:true},
	            {field:'createTime',title:'生成时间',width:'15%',sortable:true},
	            {field:'isDownload',title:'下载状态',width:'10%',sortable:true,formatter: function(value,row,index){
	            	switch (value) {
					case 1:
						return "<font color=green><b>已下载</b></font>"
						break;
					case 0:
						return "<font color=#f47920><b>未下载</b></font>"
						break;
					default:
						break;
				}
				}},
				{field:'editorName',title:'下载人',width:'8%'},
				{field:'editTime',title:'操作时间',width:'15%'}
	        ]],
	        frozenColumns:[[    
	        	{field:'id',checkbox:true},
	        	{field:'actionColumn',title:'操作列',width:80,formatter: function(value,row,index){
	            	var downloadLink = getBasePath()+"/mdData/downloadFile.do?uuid="+row.uuid;
	        		return "<a href='"+downloadLink+"' style='color:blue'><b>下载</b></a>";
	            }},
	        ]],    
	  });
  
  //新增按钮绑定事件
  $("#addDataLink").bind("click",function(){
	  $.dataGridEasyUI.initEditWindow({
		  url:getBasePath()+"manage/mdData/editBatchDataInfo.jsp?showType=window",
		  title:"添加会员信息信息",
		  actionType:"add",
		  width:650,
		  height:320
	  });
  });
  
  //更新按钮绑定事件
  $("#updateDataLink").bind("click",function(){
	  $.dataGridEasyUI.initEditWindow({
		  url:getBasePath()+"manage/mdData/editBatchDataInfo.jsp",
		  title:"编辑批次",
		  actionType:"update",
		  width:650,
		  height:320
	  });
  });
  
  /**
   * 导入数据
   */
  $("#importDataLink").bind("click",function(){
	  $.dataGridEasyUI.initEditWindow({
		  url:getBasePath()+"manage/mdData/checkReaptData.jsp?showType=window",
		  title:"导入数据",
		  actionType:"add",
		  width:650,
		  height:300
	  });
  });
  
  //批量删除
  $("#batchDeleteLink").bind("click",function(){
	  $.dataGridEasyUI.batchDeleteData({
		  url:getBasePath()+"/mdData/batchDelBatchDataInfoForHS.do",
	  });
  });
  
  //单个删除
  $("#singleDeleteLink").bind("click",function(){
	  $.dataGridEasyUI.batchDeleteData({
		  url:getBasePath()+"/mdData/delBatchDataInfo.do",
	  });
  });
})

//永久删除数据
function batchDelInDB(){
  $.dataGridEasyUI.batchDeleteInDB({
	  url:getBasePath()+"/mdData/batchDelBatchDataInfo.do",
  });
}
         
//恢复数据
function rebackData(){
	$.dataGridEasyUI.batchDeleteInDB({
		  url:basePath+"/mdData/batchRebackData.do"
	});
}